AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "RPG_client.lua" )
AddCSLuaFile( "RPG_client_f1.lua" )
AddCSLuaFile( "RPG_client_mapHUD.lua" )
AddCSLuaFile( "RPG_client_vendorwindows.lua" )
AddCSLuaFile( "VGUI/TalentWindow.lua" )
AddCSLuaFile( "VGUI/SpellIcon.lua" )
AddCSLuaFile( "VGUI/ToolTip.lua" )
AddCSLuaFile( "VGUI/DropSpot.lua" )
AddCSLuaFile( "VGUI/DModelPanelGear.lua" )
AddCSLuaFile( "VGUI/InventoryGrid.lua" )
AddCSLuaFile( "VGUI/TalentGrid.lua" )
AddCSLuaFile( "VGUI/TalentSelection.lua" )
AddCSLuaFile( "shared.lua" ) 
AddCSLuaFile( "all_items.lua" ) 
AddCSLuaFile( "chatmanager.lua" )
AddCSLuaFile( "shared_interactable.lua" ) 
AddCSLuaFile( "setup_spellsystem.lua" ) 
AddCSLuaFile( "setup_items.lua" ) 
AddCSLuaFile( "setup_interactables.lua" ) 
AddCSLuaFile( "setup_questsystem.lua" )
AddCSLuaFile( "setup_npcsystem.lua" ) 
AddCSLuaFile( "setup_effectsystem.lua" )
AddCSLuaFile( "player_class/class_default.lua" )
AddCSLuaFile( "player_class/class_maa.lua" )
AddCSLuaFile( "player_class/class_brawler.lua" )
AddCSLuaFile( "player_class/class_mage.lua" )
AddCSLuaFile( "player_class/class_shieldbearer.lua" )
AddCSLuaFile( "player_class/class_ranger.lua" )
AddCSLuaFile( "player_class/class_tester.lua" )
AddCSLuaFile( "player_class/class_blademaster.lua" ) 
AddCSLuaFile( "player_class/class_rogue.lua" ) 
 
include( 'all_items.lua' ) 
include( 'shared_interactable.lua')
include( 'rpgdm_util.lua' )
include( 'rpgdm_playerdeath.lua' )
include( 'rpgdm_playerinjury.lua' )
include( 'shared.lua' )
include( 'setup_items.lua' )
include( 'setup_interactables.lua' )
include( 'spell_states.lua' )
include( 'setup_spellsystem.lua' )
include( 'setup_npcsystem.lua' )
include( 'setup_questsystem.lua' )
include( 'setup_effectsystem.lua' )
include( 'setup_xpsystem.lua' ) 
include( 'chatmanager.lua')
include( 'player_class/class_default.lua' )
include( 'player_class/class_maa.lua' )
include( 'player_class/class_brawler.lua' )
include( 'player_class/class_mage.lua' )
include( 'player_class/class_shieldbearer.lua' )
include( 'player_class/class_ranger.lua' )
include( 'player_class/class_tester.lua' )
include( 'player_class/class_blademaster.lua' )
include( 'player_class/class_bear.lua' )
include( 'player_class/class_rogue.lua' )
include( 'player_class/class_mage.lua' )
include( 'player_class/class_paladin.lua' )


function GM:PlayerSelectSpawn( ply )
    local spawns = team.GetSpawnPoints(ply:Team())
	if(spawns == nil)then
		spawns = ents.FindByClass("info_player_start")
	end
	if(spawns == {})then
		spawns = ents.FindByClass("info_player_terrorist")
	end
	if(spawns == {})then
		spawns = ents.FindByClass("info_player_counterterrorist")
	end
	local random_entry = math.random( #spawns )
    
    return spawns[random_entry]
end
